<%@ page language="java" pageEncoding="utf-8"%>
<%
	String ct = request.getContextPath();
%>
<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<link rel="apple-touch-icon-precomposed" href="images/todolist.png"/>
		<link rel="apple-touch-startup-image" href="images/todo-splash.png" />   
		<title>ToDo App</title>
		<link rel="stylesheet" type="text/css" href="<%=ct%>/css/tablet.css">
		<link type="text/css" href="<%=ct%>/css/demo.css" rel="stylesheet">
		
		<script type="text/javascript" src="<%=ct%>/dojo/dojox/mobile/deviceTheme.js"
   					data-dojo-config="mblThemeFiles:['@theme',['demos/todoApp','todo']]"></script>

		<script type="text/javascript" src="<%=ct%>/dojo/dojo/dojo.js" data-dojo-config="parseOnLoad: false,
				mblHideAddressBar: false,
				mblAndroidWorkaround: false,
				mblAlwaysHideAddressBar: false,
				app: {debugApp: 0},  // set debugApp to log app transtions and view activate/deactivate
				mvc: {debugBindings: 0},  // set on to debug mvc data bindings
				async: 1">
		</script>
		<title>薪酬通-薪资查询</title>
		<script type="text/javascript">
		require([ "dojo/dom",
		     	  "dojo/_base/array",
		    	  "dojo/ready",
		    	  "dijit/registry",
		    	  "dojox/mobile/ListItem",
		    	  "dojox/mobile/parser", 
	      	      "dojox/mobile/ProgressIndicator",
	      		  "dojo/_base/window",
	      		  "dojox/mobile/SearchBox",
	              "dojox/mobile",
	              "dojox/mobile/deviceTheme", "dojox/mobile/compat", 
		      	  "dojox/mobile/ProgressIndicator",
		      	  "dojo/dom-construct",
		      	  "dojox/mobile/RoundRectDataList",
		      	  "dojox/mobile/ScrollablePane",
		      	  "dojox/mobile/ScrollableView",
			      "dojox/mobile/View",
		      	  "dojox/mobile/TextArea",
		      	  "dojox/mobile/TabBar",
		      	  "dojox/mobile/StoreCarousel",
	      	      "dojo/domReady!",
			      "dojox/mobile/CheckBox",
			      "dojox/mobile/ComboBox",
			      "dojox/mobile/TextBox"], function(dom, arr, ready, registry, ListItem,parser){
				parser.parse();
				var orderno='';
				 ready(function() {
					 var params = {
							 operation:"neworderlist"
							};
						
						dojo.xhrGet({
					               url:'<%=ct%>/listOrderAction.do',
					               content:params,
					               handleAs: "json",
					               load: resultCallback,
					               error: resultError
					                });   
						});
				

			function resultCallback(data,ioArgs) {
				var salarylist = registry.byId("neworderlist");
				arr.forEach(salarylist.getChildren(), function(child){
					salarylist.removeChild(child);
				});
				arr.forEach(data, function(item, i){
					var li = new ListItem({
						onClick: getdetail,
						moveTo: "orderDetail",
					//	rightText:item.salaryMonth,
						icon:'img/tab-icon-11h.png',
						item:item

					});
					li.labelNode.innerHTML = item.suppliername;
					salarylist.addChild(li);
				});
			}
			
			function getdetail(item){
				var detail = registry.byId("detail");
				// remove anything from previous selected stock
				arr.forEach(detail.getChildren(), function(child){
					detail.removeChild(child);
				});
				orderno=this.item.orderno;
			}
			    //错误提示
			       function resultError(data, ioArgs) {
			            var Node=document.getElementById("neworderlist");
			             var listItem=document.createElement("li");		             
					     listItem.innerHTML=("网络异常!请重新操作!"); //使用占位符
					     Node.appendChild(listItem);
			       }
					
					function resultCalldetail(data,ioArgs) {
						var detail = registry.byId("ordersdetail");
						// remove anything from previous selected stock
						arr.forEach(detail.getChildren(), function(child){
							detail.removeChild(child);
						});					
						arr.forEach(data, function(item){
							var li = new ListItem({
								onClick: getdetail,
								moveTo: "orderDetail",
								rightText:item.inmoney,
								icon:'img/tab-icon-11h.png',
								item:item

							});
							li.labelNode.innerHTML = item.gdsname;
							detail.addChild(li);
						});
			   	}
		});
		</script>
	</head>
	<body>
		<div id="home" data-dojo-type="dojox.mobile.View" >
			<h1 data-dojo-type="dojox.mobile.Heading" data-dojo-props="back:'订单明细', moveTo:'orderDetail'">订单商品明细列表</h1>
			<ul data-dojo-type="dojox.mobile.RoundRectList" id="ordersdetail">	
			</ul>
		</div>

		<div id="orderDetail" data-dojo-type="dojox.mobile.View">
			<h1 data-dojo-type="dojox.mobile.Heading" data-dojo-props="back:'订单列表', moveTo:'home'">订单明细</h1>
			<ul data-dojo-type="dojox.mobile.RoundRectList" id="detail">
			</ul>
		</div>

	</body>
</html>